<? 
include("../../infopix.core.php5/Grid.class.php");
include("../../infopix.core.php5/DB/DataBase.class.php");
include("../../infopix.core.php5/GridSource.class.php");
include("../../infopix.core.php5/GridPresenter.class.php");
include("../../infopix.core.php5/GUI/HtmlLink.class.php");
include("../../infopix.core.php5/GUI/ComboBox.class.php");
include("../../infopix.core.php5/GridLinker.class.php");
include "../../infopix.core.php5/GridSorter.class.php";
include "../../infopix.core.php5/GridSortPage.class.php";
#include("../../infopix.core.php5/Security/User.class.php");
#include("../../infopix.core.php5/Security/SecurityManager.class.php");
include("../../infopix.core.php5/Utilities/Application.class.php");


// INSERT INTO  `thechurch`.`users` (
// 		`idusers` ,
// 		`firstname` ,
// 		`lastname` ,
// 		`login` ,
// 		`password` ,
// 		`idroles`
		
if($login){

	$sql = "INSERT INTO users VALUES (null, '$firstname','$lastname', '$login', '$password','$idroles')";
	$res = DataBase::ExecuteNonQuery($sql);
	if($res)
		echo "<script> window.location = '../select/usersinfo.php' </script>";
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="" method="post" name="miform" >
<table width="0%" align="center" border="0">
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>

  <tr>
    <td>Nombre</td>
    <td><input type="text" name="firstname" id="firstname" /></td>
  </tr>
  <tr>
    <td>Apellido</td>
    <td><input type="text" name="lastname" id="lastname" /></td>
  </tr>
    <tr>
    <td>ID Usuario</td>
    <td><input type="text" name="login" id="login" /></td>
  </tr>
  <tr>
    <td>Password</td>
    <td><input type="password" name="password" id="password" /></td>
  </tr>
  <tr>
    <td>Rol</td>
    <td>
		<?php
			$sql="SELECT idroles,name FROM roles";  
			$cmb= new Combo();
			$cmb->AddItem(0,"Selecciona");
			$cmb->FillDB($sql);
			$cmb->Render("idroles");
		?>
    </td>
  </tr>
  <tr>
    <td colspan="2"><div align="center"><input type="submit" value="Guardar" name="Guardar" /></div></td>
    </tr>
</table>
</form>

</body>
</html>